import { Injectable } from "@angular/core";
import { Subject, Observable } from 'rxjs';

@Injectable({
  providedIn: "root"
})
export class SearchListService {
  // 声明主题对象
  private subject: Subject<any> = new Subject<any>();


  getMessage(): Observable<any> {
    return this.subject.asObservable();
  }


  sendMessage(msg: any) {
    if (msg) {
      this.subject.next(msg);
    }
  }

  clearMessage() {
    this.subject.next();
  }

  constructor() {}
}
